package co.dreamapps.dodoattack.configuration;

import android.content.Context;
import android.content.SharedPreferences;

public class Persistence {

	/**
	 * Constants
	 */
	private static final String CONFIGURATIONS = "CONFIGURATIONS";
	private static final String USER_NAME = "USER_NAME";

	/**
	 * Private attributes
	 */
	private SharedPreferences settings;

	/**
	 * Public settings
	 */
	public String username;

	public Persistence(Context context) {
		settings = context.getSharedPreferences(CONFIGURATIONS, 0);
		username = settings.getString(USER_NAME, "");
	}

	public void commitChanges() {
		SharedPreferences.Editor editor = settings.edit();
		editor.putString(USER_NAME, username);
		editor.commit();
	}

}
